package com.exercise.widgets.searchable

import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.view.LayoutInflater
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import com.exercise.struct.base.BaseActivity
import com.exercise.struct.viewmodel.BaseViewModel
import com.exercise.widgets.R
import com.exercise.widgets.databinding.ActivitySearchEntryBinding
import com.exercise.widgets.settings.PreferenceActivity

class SearchEntryActivity : BaseActivity<BaseViewModel, ActivitySearchEntryBinding>() {
    override val bindingInflater: (LayoutInflater) -> ActivitySearchEntryBinding
        get() = ActivitySearchEntryBinding::inflate
    override val modelClass: Class<BaseViewModel>
        get() = BaseViewModel::class.java

    override fun initData() {
    }

    override fun initView() {
        binding.searchBtn.setOnClickListener {

            onSearchRequested()
        }
    }

    override fun onSearchRequested(): Boolean {
        val apply = Bundle().apply {
            putBoolean("jargon", true)
        }
        startSearch(null, false, apply, false)
        return true
    }

    companion object{
        fun start(context: Context) {
            Intent(context, SearchEntryActivity::class.java).also {
                context.startActivity(it)
            }
        }
    }
}